package com.threader.bo;

import java.util.Observable;
import java.util.SortedMap;
import java.util.TreeMap;

public class Memory extends Observable {
	private long id;
	private People master;
	
	private SortedMap<String, People> familiar;

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	public SortedMap<String, People> getFamiliar() {
		if(familiar == null)
			setFamiliar(new TreeMap());
		return familiar;
	}
	public void setFamiliar(SortedMap<String, People> familiar) {
		this.familiar = familiar;
	}

	public boolean isKnowYuo(People people){
		return getFamiliar().get(people.getName())!=null;
	}

	public void rememberPeople(People people){
		if(!isKnowYuo(people)){
			getFamiliar().put(people.getName(), people);
			getMaster().log("I met "+people.getName());
		}
	}
	public void setMaster(People master) {
		this.master = master;
	}
	public People getMaster() {
		return master;
	}

}
